package com.wsc.springbootmultidevdemo.msg.pubnsub;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.wsc.springbootmultidevdemo.msg.ConnectionUtil;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Send {

    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();

        String exName = "fanout";
        for (int i = 0; i <10 ; i++) {
            String message = "Hello rabbit "+i;
            channel.basicPublish(exName,"",null,message.getBytes("UTF-8"));
        }

        channel.close();
        connection.close();
    }



}
